fix(desktop): surface invite creation errors separately from clipboard failures - #3691
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): surface invite creation errors separately from clipboard failures#3691iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…d failures The invite link copy handler wrapped both mintInvite and writeTextToClipboard in a single try/catch. When mintInvite failed (e.g. CORS preflight rejected, 403 Forbidden), the user saw "Couldn't copy the invite link" — misattributing a server/network error to the clipboard. This separates the two failure modes: - mintInvite failure: "Couldn't create the invite: <error message>" The error from invitePost (which includes the relay's json.error or HTTP status) is now surfaced to the user. - clipboard failure: "Invite created, but copying to the clipboard failed." — distinct message acknowledging the invite was minted but copying failed (important because relay_invites stores only token_hash, so the code is unrecoverable). Closes block#3636
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When creating an invite link failed (e.g. CORS preflight rejected, 403 Forbidden, network timeout), the user saw "Couldn't copy the invite link. Try again." — misattributing a server/network error to the clipboard. This was actively misleading: the clipboard worked fine elsewhere in the app, but the error message sent users looking at Tauri clipboard permissions instead of the network.
Closes #3636 (desktop part)
Root Cause
handleCopyinInviteLinkSection.tsxwrapped bothmintInviteandwriteTextToClipboardin a singletry/catch. Any failure from either call produced the same generic "couldn't copy" toast, discarding the actual error message from the relay.invitePostalready throws a usefulError— either the server'sjson.errorstring orHTTP <status>— but that message was being swallowed.Solution
Split the single
try/catchinto two:mintInvitefailswriteTextToClipboardfailsThe second message is materially different: because
relay_invitesstores onlytoken_hash, an invite whose code fails to reach the clipboard is unrecoverable. Telling the user it was created but not copied is different from telling them to just try again.Test Plan
cd desktop node --test src/features/community-members/ui/inviteLinkErrorSeparation.test.mjsAll 6 tests pass: